<html>
 <head>
  <title>PHP Demo A2.3</title>
 </head>

<body>

<h1>Demo A2.3</h1>

<p>


<?php

//  phpinfo();

  echo "<p>" . `/bin/date` . "<p>";

// import the PHP code that make it so easy to access the remote server
  require('HttpClient.class.php');

// create a "client" object which will access the desired web site
  $client = new HttpClient('media.jcu.edu.au');

// leave debug off UNLESS you have problems
  $client->setDebug(false);

// grab a news item
  if ( ! $client->get('/story.cfm?id=777 ') ) {
    die( 'An error occurred: ' . $client->getError() );
  }

// copy the web page contents into $pageContents and display
  $pageContents = $client->getContent();

echo '<p> Here is a raw dump of the same HTML.

<hr>

<pre>
';
  print str_replace( '<', '&lt;', $pageContents );
  echo '</pre>';

?>
 
<p>

<hr>

</body>
</html>
